package com.example.testapplication;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wwq Administrator
 */
public class QuestionList extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.activity_question_list,container,false);

        RecyclerView recycleView = view.findViewById(R.id.recyclerView);
        List<Question> list = new ArrayList<>();
        for (int i = 0;i < 10; i++) {
            Question question = new Question();
            question.setTitle("延安市2019年普通国省干线公路安全生命防护工程设计单位的负责人求告知"+i);
            list.add(question);
        }
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(list);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false);
        recycleView.setLayoutManager(layoutManager);
        recycleView.setAdapter(adapter);

        return view;
    }



//    private void initData(){
//        RecyclerView recycleView = findViewById(R.id.recyclerView);
//        List<Question> list = new ArrayList<>();
//        Question question = new Question();
//        for (int i = 0;i < 10; i++) {
//            question.setTitle("延安市2019年普通国省干线公路安全生命防护工程设计单位的负责人求告知");
//            list.add(question);
//        }
//        RecyclerViewAdapter adapter = new RecyclerViewAdapter(list);
//        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
//        recycleView.setLayoutManager(layoutManager);
//        recycleView.setAdapter(adapter);
//    }
}
